﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using mal.balades.SlideShow.ViewModel;
using System.Windows.Browser;
using mal.balades.SlideShow.Message;
using GalaSoft.MvvmLight.Messaging;
using System.Windows.Threading;

namespace mal.balades.SlideShow
{
    public partial class MainPage : UserControl
    {
        private DispatcherTimer timer;
        public MainPage()
        {
            InitializeComponent();

            //AddImage("http://autourdeaix.free.fr/photos/Ansouis/ansouis-001.jpg", "Chateau d'Ansouis");
            //AddImage("http://autourdeaix.free.fr/photos/Ansouis/ansouis-007.jpg", "Chateau d'Ansouis");
            //AddImage("http://autourdeaix.free.fr/photos/Ansouis/ansouis-008.jpg", "Chateau d'Ansouis");
            //AddImage("http://autourdeaix.free.fr/photos/Ansouis/ansouis-011.jpg", "Chateau d'Ansouis");

            //Messenger.Default.Register<PlayMessage>(this, PlayMessageHandler);

            timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(2);
            timer.Tick += new EventHandler(timer_Tick);
        }

        void timer_Tick(object sender, EventArgs e)
        {
            closeMenu.Begin();
        }
        

        private void LayoutRoot_MouseMove(object sender, MouseEventArgs e)
        {
            showMenu.Begin();

            if (timer.IsEnabled)
                timer.Stop();

            timer.Start();
        }       

        
    }
}
